home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / byteorder_md.h < prev    next >
C/C++ Source or Header  |  1998-09-15  |  1KB  |  38 lines

  1. /*
  2.  * @(#)byteorder_md.h    1.8 98/07/01
  3.  *
  4.  * Copyright 1995-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. /*-
  16.  * Win32 dependent machine byte ordering (actually intel ordering)
  17.  */
  18.  
  19. #ifndef _WIN32_BYTEORDER_MD_H_
  20. #define _WIN32_BYTEORDER_MD_H_
  21.  
  22. #ifdef    x86
  23. #define ntohl(x)    ((x << 24) |                 \
  24.                ((x & 0x0000ff00) << 8) |        \
  25.               ((x & 0x00ff0000) >> 8) |         \
  26.               (((unsigned long)(x & 0xff000000)) >> 24))
  27. #define ntohs(x)    (((x & 0xff) << 8) | ((x >> 8) & (0xff)))
  28. #define htonl(x)    ntohl(x)
  29. #define htons(x)    ntohs(x)
  30. #else    /* x86 */
  31. #define ntohl(x)    (x)
  32. #define ntohs(x)    (x)
  33. #define htonl(x)    (x)
  34. #define htons(x)    (x)
  35. #endif    /* x86 */
  36.  
  37. #endif /* !_WIN32_BYTEORDER_MD_H_ */
  38.